﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace VisionRoc_Measure
{
    public partial class FormProgressBar : Form
    {
        public FormProgressBar()
        {
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true); // 禁止擦除背景 
            SetStyle(ControlStyles.DoubleBuffer, true); // 双缓冲  
            SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            this.DoubleBuffered = true;//避免时间显示控件闪烁
            InitializeComponent();
            Control.CheckForIllegalCrossThreadCalls = false;
            progressBar1.Maximum = 100;
        }

        /// <summary>
        /// 加载信息
        /// </summary>
        /// <param name="Message">加载信息</param>
        /// <param name="progressBar">加载进度</param>
        public void LoadMessage(string Message,int progressBar)
        {
            label_LoadMessage.Text = Message;
            progressBar1.Value += progressBar;
            if(progressBar1.Maximum==progressBar1.Value)
            {
                Thread.Sleep(1000);
                this.Close();
            }
        }

        private void FormProgressBar_Load(object sender, EventArgs e)
        {
            //label1.BackColor = Color.Transparent;
            //label1.Parent = pictureBox1;
            //label1.Location = new Point(120, 60);

        }
    }
}
